package com.wan37.logic.domain.vo;

import com.wan37.logic.domain.entity.UserItemDO;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : luoyong
 * @date : 2020-06-17 10:35
 **/
public class ItemVO extends BackpackVO {

    private volatile Integer count;
    private String englishName;

    public ItemVO(){}

    public ItemVO(ItemVO itemVO) {
        setBackpackId(itemVO.getBackpackId());
        setCount(1);
        setEnglishName(itemVO.getEnglishName());
        setName(itemVO.getName());
        setMaxRepetition(itemVO.getMaxRepetition());
        setLabel(itemVO.getLabel());
        Map<String, Long> numberMap = new HashMap<>();
        itemVO.getNumberMap().forEach((k,v)->numberMap.put(k,v));
        setNumberMap(numberMap);
    }

    public ItemVO(UserItemDO userItemDO) {
        setBackpackId(userItemDO.getItemId());
        setCount(userItemDO.getCount());
    }

    public String getEnglishName() {
        return englishName;
    }

    public void setEnglishName(String englishName) {
        this.englishName = englishName;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "ItemVO{" +
                "count=" + count +
                '}';
    }
}
